<?php
/**
 * <https://y.st./>
 * Copyright © 2019 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => '&quot;Textures&quot;',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2019/07/25.jpg" alt="A roadblock on the bike path" class="framed-centred-image" width="800" height="480"/>
<section id="diet">
	<h2>Dietary intake</h2>
	<p>
		For breakfast, I had a bowel of cereal.
		For lunch, I had a small quesadilla, using the last of my tortillas.
		I didn&apos;t want to break open a new block of tapioca cheese for it though, and was at the end of the block I had, so it had a pitiful amount of cheese on it.
		Not really filling at all.
		I snacked on dried cherries though to compensate.
		For dinner, I had a slice of muffuletta.
	</p>
</section>
<section id="drudgery">
	<h2>Drudgery</h2>
	<p>
		My discussion post for the day:
	</p>
	<blockquote>
		<p>
			I&apos;ve always thought of the use of $a[XML] files to specify layouts in Android applications, instead of forming the layouts in the main Java code, to be similar to the separation of style from markup in $a[CSS] and $a[XHTML] (or $a[HTML], if you prefer to use that language instead despite it being so much messier).
			It&apos;s not quite the same.
			$a[XHTML] does still very much influence the layout, but separating out the style into $a[CSS] has a number of benefits.
			You can use the same style on multiple pages.
			You can update the style once and it&apos;ll be updated for all pages that use it.
			There&apos;s even a lesser-known feature that allows websites to specify multiple styles and allow the user to choose one.
			The setting is found in the Web browser&apos;s menus, so because it&apos;s not well-known, users tend not to know to look for it and don&apos;t use anything besides the default, but that option is still there.
			You also don&apos;t have to repeat the same styling information for each and every element, and can say, for example, that all <code>&lt;h2/&gt;</code> elements on the page should be styled the same way.
			You can even specify per-screen-size styles for responsive design, or per-device-type styles to allow your website to be colourful when seen in a Web browser but not waste expensive, coloured ink when printed out.
			In a way, you separate form from function, with $a[CSS] providing the form and $a[XHTML] providing the function.
		</p>
		<p>
			Android&apos;s $a[XML] layouts serve a similar purpose, though they&apos;re implemented quite differently.
			You still have the option to specify multiple layouts though, and the Android system chooses the correct one for the device and the device&apos;s orientation (Udacity, n.d.).
			This too is called responsive design, but instead of specifying styling rules, you specify interface layouts.
			Either way, you&apos;re making what is displayed work better for a wider range of devices by providing multiple rendering options and allowing the device to choose the the one that best fits its own situation.
			You can also use the same layout for multiple activities provided by the application, again reminiscent of $a[CSS] being used on multiple pages, and you can use one $a[XML] layout from within another $a[XML] layout, allowing further reuse of layouts so they don&apos;t have to be defined multiple times, so you don&apos;t have to update the same thing in multiple places (Udacity, n.d.), and again similar to $a[CSS]&apos; ability to import style sheets from within other style sheets.
			You can also allow the user to switch layouts by having your Java code choose a set $a[XML] files based on user settings, similar to providing multiple styling options for a webpage.
			Admittedly, the comparison isn&apos;t perfect, but you can see that $a[XML] layouts in Android serve a similar role as $a[CSS] does for webpages.
		</p>
		<p>
			I tried to come up with ways in which this system of using $a[XML] layouts separated form the Java code is somehow bad, to contrast with the good aspects mentioned above, but I couldn&apos;t find anything that relates to the final applications.
			It makes it a bit harder to test things out during development, as you can&apos;t simply throw together some Java code to test a feature, and need to actually create an $a[XML] layout if you want anything to display on the screen.
			The system also seems a bit cumbersome to use, but what better alternatives could there be that offer the same features for supporting various device sizes and both possible orientations?
			If I could even come up with a better system, it&apos;d take me years of actively thinking on the problem.
			All things considered, while there are definitely some improvements that could be made in how the Android system <strong>*transitions*</strong> between layouts (such as when switching between device orientations), this isn&apos;t a problem in the layout system itself.
			Separating the layouts into separate $a[XML] files provides all the benefits listed above and perhaps more, with no substantial drawbacks that I could come up with.
		</p>
		<div class="APA_references">
			<h3>References:</h3>
			<p>
				Udacity.
				(n.d.).
				<a href="https://www.udacity.com/course/new-android-fundamentals--ud851#">Developing Android Apps | Udacity</a>.
				Retrieved from <code>https://www.udacity.com/course/new-android-fundamentals--ud851#</code>
			</p>
		</div>
	</blockquote>
	<p>
		During the $a[EUGLUG] meeting, I got the grading for the week done, as well as submitted the assignment for one course, as I practically completed it two weeks ago.
		I just needed to do some last-minute finalisations, given that I now had the actual instructions in front of me and knew what to submit.
		After that, I wasn&apos;t sure what to start working on, and ended up settling on the main project for the other course.
		It looked like an exceedingly easy project: add textures to spheres, male one rotate, and make the other orbit the first.
		Then put textures on them to male them look like the earth and moon.
		Add some lighting for effect to simulate the sun.
		Easy.
		Using my knowledge of the moon, I was going to make the same side of the moon always face the earth, because the actual moon does that.
		We always see the same side from here.
		Exploiting that fact of the universe actually would make the assignment easier too, as I could make the moon&apos;s point of rotation outside its actual geometry, and then just rotate the moon.
		The side effect of this strategy is that the same side always faces the point of rotation, but in this case, that behaviour is a feature, not a bug.
	</p>
	<p>
		But then I decided to apply the textures before doing much else, so as I worked on the rendering, I would see if it worked properly while textured and wouldn&apos;t need to have to go back later and fix a bunch of bugs.
		I took a look at the &quot;textures&quot; we were supposed to work with.
		They were snapshots of the earth and moon.
		My heart fell.
		Those weren&apos;t textures at all.
		They weren&apos;t even functional as textures.
		I was expecting something in the format of one of those world maps, where the poles are stretched but the entire earth is shown, but I was expecting it to be constructed from photographic data.
		Why was I expecting that?
		Well, that format is the only format that&apos;d work for the texturing.
		As for being constructed from photographic data, that&apos;s what would make it look like the example screenshot we were shown.
		This looked like such an easy project.
		Yet we were given &quot;textures&quot; that weren&apos;t usable as textures and told that they were the ones we were required to use.
		I ended up writing for help in the forum:
	</p>
	<blockquote>
		<p>
			The images we&apos;re supposed to use as the textures for the earth and moon for the Unit 6 project don&apos;t actually work as textures.
			When I read the assignment, I assumed the &quot;textures&quot; would be what was needed: images that could be wrapped around the spheres.
			Instead, they&apos;re photographs of one side of the celestial body.
			This causes two major problems. First of all, you see the body from one angle and one angle alone.
			Applying the image as a texture causes the image of one side to be stretched around the entire sphere.
			Secondly, the usable part of the image is round, not square.
			This results in the black outer part of the images (the background) to be applied to the spheres as well, which looks horrendous.
			There is no way to get a proper rendering out of these &quot;textures&quot;, because they&apos;re not textures, but photographs of round objects.
			What are we supposed to do?
			Are we allowed to modify these images?
			I could make something that halfway works in the $a[GIMP] using these as a starting point.
			I couldn&apos;t fix the one-side issue, but I could trim off the black, stretch the circle into a square, and mirror it to crate a texture in which the planet has two of the same side, but one flipped so they don&apos;t have as much of an ugly seam.
			Even this solution isn&apos;t great, though at least it wouldn&apos;t render the poles of the bodies black and have a large, black seam down the side of them.
		</p>
	</blockquote>
</section>
<section id="Minetest">
	<h2>Minetest</h2>
	<img src="/img/CC_BY-SA_3.0/minetest.net./weblog/2019/07/25.png" alt="This isn&apos;t even all the mushrooms I own." class="framed-centred-image" width="1024" height="600"/>
	<p>
		I forgot that you can&apos;t place slabs sideways any more in Minetest Game.
		I think it&apos;s ridiculous that they removed that functionality.
		But anyway, sideways slabs were a vital part of the design for the entrance to the giant tree hollow.
		I might be able to come up with another design.
		If I can&apos;t though, I&apos;ll either need to replace the nice doorways with basic doors, which look great on normal buildings but would look terrible on the side of a tree, or scrap the giant tree idea altogether.
		That&apos;d be a shame.
	</p>
</section>
END
);
